import { createRouter, createWebHashHistory, type RouteRecord } from "vue-router";

import Layout from "../layout/index.vue";

const routes: any = [
    {
        path: "/",
        redirect: "/home",
        component: Layout,
        children: [
            {
                path: "/home",
                name: "home",
                component: () => import("../views/home.vue"),
                meta: {
                    keepAlive: true,
                    title: "青松 BLOG",
                    desc: "不忘初心",
                },
            },
            {
                path: "/classify",
                name: "classify",
                component: () => import("../views/classify.vue"),
                meta: {
                    keepAlive: true,
                    title: "分类&标签",
                },
            },
            {
                path: "/placeFileClassify",
                name: "placeFileClassify",
                component: () => import("../views/placeFileClassify.vue"),
                meta: {
                    keepAlive: false,
                    title: "分类&标签",
                },
            },
            {
                path: "/placeFile",
                name: "placeFile",
                component: () => import("../views/placeFile.vue"),
                meta: {
                    keepAlive: true,
                    title: "归档",
                },
            },
            {
                path: "/share",
                name: "share",
                component: () => import("../views/share.vue"),
                meta: {
                    keepAlive: true,
                    title: "分享",
                },
            },
            {
                path: "/collect",
                name: "collect",
                component: () => import("../views/collect.vue"),
                meta: {
                    keepAlive: true,
                    title: "收藏",
                },
            },
            {
                path: "/read",
                name: "read",
                component: () => import("../views/read.vue"),
                meta: {
                    keepAlive: false,
                    showReturn: true,
                    title: "阅读",
                },
            },
            {
                path: "/record",
                name: "record",
                component: () => import("../views/record.vue"),
                meta: {
                    keepAlive: true,
                    title: "记录",
                },
            },
            {
                path: "/leaveMsg",
                name: "leaveMsg",
                component: () => import("../views/leaveMsg.vue"),
                meta: {
                    keepAlive: true,
                    title: "您的意见",
                },
            },
            {
                path: "/aiDemo",
                name: "aiDemo",
                component: () => import("../views/testDemo/aiDemo.vue"),
                meta: {
                    keepAlive: true,
                    title: "AI-DEMO",
                },
            },
            {
                path: "/excelTest",
                name: "excelTest",
                component: () => import("../views/testDemo/excelTest.vue"),
                meta: {
                    keepAlive: true,
                    title: "excel-DEMO",
                },
            },
            {
                path: "/h5pDemo",
                name: "h5pDemo",
                component: () => import("../views/testDemo/h5pDemo.vue"),
                meta: {
                    keepAlive: true,
                    title: "h5p-DEMO",
                },
            },
        ],
    },
];

const router = createRouter({
    history: createWebHashHistory(),
    routes,
});

export default router;
